1. Technical Field
This invention relates to the field of network interprocess communications and more particularly to a system and method for high speed interprocess communications.
2. Description of the Related Art
Interprocess communications (IPC) includes both process synchronization and messaging. Messaging, or message passing, can be accomplished using pipes, sockets, or message queues. Pipes provide a byte stream mechanism for transferring data between processes. System calls, for example read and write calls, provide the underlying mechanisms for reading and writing data to a pipe. As the writing process writes to a pipe, bytes are copied from the sending process into a shared data page. Subsequently, when the reading process reads, the bytes are copied out of the shared data page to the destination process. Sending a message using a pipe consumes a minimum of two memory copies moving a total of 2n bytes, where n is the number of bytes in the message. Sockets provide an abstraction mechanism for application programs which can simplify access to communications protocols. Although network communications provide the primary impetus for sockets, sockets may be used for IPC, as well. Still, the transmission of data between processes using a socket can consume time necessary to perform the abstraction overhead, two system calls, for example readv( ) and writev( ), and a minimum of two memory copies moving, in total, 2n bytes. A message queue is an IPC mechanism that is typically managed by an operating system kernel. Typically, the implementation of a message queue is hidden.
Traditional IPC mechanisms can provide IPC between two processes using virtual memory in a shared memory space contained within an operating system kernel. The use of virtual memory implies that, although all processes share the same physical memory space, each process can map a region of the shared memory space differently from other processes. Thus, data residing at one address in the shared memory space can differ physically from the data residing at the same address into the same shared memory space as interpreted by the memory map of a different process.
In traditional IPC, a first process can copy n bytes of data from user memory space into a shared memory space in the operating system kernel. Subsequently, using a system call to the operating system kernel, a second process can copy the same n bytes of data from the shared memory space into the user memory space. Therefore, traditional IPC mechanisms require a minimum overhead of 2n byte copies to communicate n bytes of data between the two processes.
In addition, all methods of traditional IPC require some type of interaction with the operating system kernel. In particular, traditional IPC mechanisms require a minimum of two system calls to the operating system kernel. Moving data in and out of an operating system kernel can include some risk. Specifically, not only must each process move n bytes of data, but each process risks losing CPU control upon invoking the system call required to read or write the data, respectively.
Analogously, computer scientists have recognized the unnecessary expense of passing a message from one process to another. In fact, legacy third-generation programming languages which provide dynamic memory allocation, for example Fortran, inefficiently pass data between processes by copying the data stored in one region of memory, and storing the data in a different region of memory. Subsequently, the recipient function can process the data before returning a copy of the same using the same mechanism. Recognizing the inefficiencies of this type of message passing, computer scientists have adopted pointer passing as an alternative to data passing when messaging a process. In pointer passing, a recipient process receives only an address of a location in memory of the message data. Subsequently, the recipient can manipulate the data at the passed address, in place, without the need for excessive data copies.
Still, in third-generation languages which have adopted pointer passing, for example C or C++, the communicating processes ultimately share one memory mapping of a shared memory space for passing data. In fact, in the absence of a single memory map of shared memory space, present methods of pointer passing become unworkeable because data residing at an address in one memory space is not equivalent to the data residing at the same address in another memory space. Therefore, traditional pointer passing cannot be used to resolve the inefficiencies of traditional IPC in which different processes have different memory maps of a shared region of user memory by virtue of the virtual memory scheme associated with network IPC.
In view of the inefficiencies of traditional IPC, traditional mechanisms for IPC are not suitable for real time command and control systems which can require fail-safe and extremely fast conveyancing of information between processes. For example, copying data can be expensive in terms of processor overhead and time delay. In addition, moving data in and out of an operating system kernel can include some risk. Thus, present IPC mechanisms do not provide the level of service required for real-time applications.